Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-111178: fix UBSan failures in Objects/descrobject.c #128245

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

picnixz
Copy link
Contributor

@picnixz picnixz commented Dec 25, 2024

{"__name__", (getter)property_get__name__, (setter)property_set__name__},
{"__isabstractmethod__",
(getter)property_get___isabstractmethod__, NULL,
{"__name__", property_get__name__, property_set__name__, NULL, NULL},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me wonder: what's your reason for adding the NULLs?
(C only needs one value and zeroes the rest, and many of these structs have more rarely used stuff at the end -- though perhaps the reasons for that are more historical than ergonomic.)

Copy link
Contributor Author

@picnixz picnixz Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that if we have a half-initialized object, it's somewhat harder for new readers to know that there's still the NULL doc field and closure. I think I'm unfortunately not constant in where I'm adding those NULLs so feel free to remove them (but since I was anyway modifying the line, I took the initiative of keeping them).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding .doc=NULL might be more helpful -- it would point out what is missing.
The closure is very rarely needed; IMO it's best to leave it out.

Anyway, it's an unimportant style nitpick; please consider it for the future edits :)

@encukou encukou merged commit 1ef6bf4 into python:main Jan 6, 2025
47 checks passed
@picnixz picnixz deleted the fix/ubsan/descriptors-111178 branch January 6, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants